# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test09
# Description:  例11.7
# Author:       ASUS
# Date:         2019/3/25
#-------------------------------------------------------------------------------



#在模式字符串中加几个括号，模式字符串就会将匹配成功的字符串分为几个组，通过group方法的参数获取指定组匹配的字符串
import re
m = re.match("(\d{3})-(\d{4})-([a-z]{2})","123-4567-xy")
if m is not None:
    print(m.group())
    print(m.group(1))
    print(m.group(2))
    print(m.group(3))
    print(m.groups())                #获取每组的值组成的元组



